package com.dd.cloud.user.service.paynotice.promode.notice;

import com.dd.cloud.user.entity.order.OrderPay;
import com.dd.cloud.user.service.log.ILogErrorService;
import com.dd.cloud.user.service.paynotice.promode.NoticeService;
import com.dd.cloud.user.service.paynotice.promode.NoticeType;
import com.zk.pay.constants.CS;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;

/**
 * 退款预约产品回调
 */
@Slf4j
@NoticeType(source = CS.NOTICE_SOURCE.REFUND, proType = CS.NOTICE_CHANNEL.MONTH)
public class ProductRefundNoticeService implements NoticeService {
    @Autowired
    private ILogErrorService logErrorService;

    /**
     * 退款处理逻辑
     *
     * @param request
     * @param orderPay 订单对象
     * @param flowNo   流水编号
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    @Async
    public void notice(HttpServletRequest request, OrderPay orderPay, String flowNo) {
        try {
            String serverNo = orderPay.getServerNo();
        } catch (Exception e) {
            e.printStackTrace();
            logErrorService.presBackLog("预约回调退款抛异常", "预约退款回调异常", "serverNo=" + orderPay.getServerNo());
        }
    }
}
